<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');


//get variables passed from add.php
$building_id = mysql_real_escape_string(strip_tags($_POST['bid']));
$room_num = mysql_real_escape_string(strip_tags($_POST['room_num']));
$num_seats = mysql_real_escape_string(strip_tags($_POST['num_seats']));
$type_id = mysql_real_escape_string(strip_tags($_POST['type']));

$get_building_data = mysql_query("SELECT * FROM buildings WHERE id = $building_id");
$building_name = mysql_result($get_building_data,0,'building_name');
$abbreviation = mysql_result($get_building_data,0,'abbreviation');

echo "<h1>Add Classroom in $building_name</h1>";

$query2 = "INSERT INTO classrooms (id, room_num, building_id, classroom_type_id, num_seats)
VALUES
('','$room_num','$building_id','$type_id','$num_seats')";

$result2 = mysql_query($query2);

if ($result2)
{
	echo "<b>".stripslashes($abbreviation)." ".stripslashes($room_num)."</b> has been successfully added!";
	echo "<br />";
}
else
{
	echo "<b>$abbreviation $room_num</b> was NOT able to be added at this time!";
	echo "<br />";
}

//close
mysql_close();

echo "<p>";
	echo "<a href='index.php?id=$building_id'>&lt;&lt; Back to Classrooms Portal</a><br />";
echo "</p>";

?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>